<?php
include('auth.php');
include('../config.php');   
   
echo('  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

		<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de-de" lang="de-de">

		<head>
			<meta http-equiv="content-type" content="text/html; charset=utf-8" />
			<title>Wilkommen beim Buchungssystem der Landsmannschaft Preußen !</title>
			<script src="../md5.js"></script>
			<script src="administration.js"></script>
			<style type="text/css">
			<style> a img { border:0 } </style>


		<link rel="stylesheet" href="http://preussen.net/templates/preussen_template/css/template.css" type="text/css" />
		<link href="http://preussen.net/templates/preussen_template/ja_menus/ja_splitmenu/ja.splitmenu.css" rel="stylesheet" type="text/css" />


		<!--[if lte IE 6]>
		<style type="text/css">
		.clearfix {height: 1%;}
		img {border: none;}
		</style>
		<![endif]-->

		<!--[if gte IE 7.0]>
		<style type="text/css">
		.clearfix {display: inline-block;}
		</style>
		<![endif]-->

		<!--[if gt IE 7]>
		<link href="http://preussen.net/templates/preussen_template/css/ie8.css" rel="stylesheet" type="text/css" />
		<![endif]-->

		</head>
		<body id="bd" class=" wide fs3" style="background-image: url(http://preussen.net/templates/preussen_template/images/background/pat-1.jpg);"">

		<div id="ja-wrapper">

			<div id="ja-topbar" class="clearfix">
				<div id="ja-pathway"></div>
			</div>

			<!-- BEGIN: HEADER -->
			<div id="ja-header" class="clearfix">

					<h1 class="logo">
						<a href="/index.php" title="Landsmannschaft Preußen"><span>Landsmannschaft Preußen Bierliste</span></a>
					</h1>
				
				<!-- BEGIN: MAIN NAVIGATION -->
				<div id="ja-mainnav">
					<div id="ja-splitmenu" class="mainlevel clearfix">
						<ul>
						  <li class="menu-item0 first-item"><a href="../index.php" class="menu-item0 active first-item" id="menu1" title="Bierliste"><span class="menu-title">Bierliste</span></a></li>
						  <li class="menu-item1 active last-item"><a href="index.php" class="menu-item1" id="menu53" title="Verwaltung"><span class="menu-title">Verwaltung</span></a></li><li class="menu-item2"></li>
						  </ul>
					</div>	
				</div>


			</div>
			<!-- END: HEADER -->
			<div id="ja-subnav" class="clearfix">
				<div class="sublevel">
					<ul>
	'); // end echo
	
	if ( $_SESSION['AUTH_LEVEL'] >=0) {
			echo('<li class=" first-item"><a href="javascript:showPWChangeForm()" class=" first-item" id="" title="Persönliches Passwort ändern"><span class="menu-title">Kontodaten ändern</span></a></li>');
	} 
	if ( $_SESSION['AUTH_LEVEL'] >= 2) {
          echo('<li class=" last-item"><a href="javascript:showNewUser()"><span class="menu-title">Neuen Nutzer anlegen</span></a></li>');
	}
	if ( $_SESSION['AUTH_LEVEL'] >= 3) {
		  echo('<li class=" first-item"><a href="javascript:showAccounts()"><span class="menu-title">Kontostände einsehen</span></a></li>');
          echo('<li class=" first-item"><a href="javascript:showPayment()"><span class="menu-title">Gutschrift verbuchen</span></a></li>');
		  echo('<li class=" first-item"><a href="javascript:showInvoice()"><span class="menu-title">Abrechnungen</span></a></li>');
	}
	if ( $_SESSION['AUTH_LEVEL'] >= 3) {
		  echo('<li class=" first-item"><a href="javascript:showStock()" class=" last-item" id="" title="Lager"><span class="menu-title">Inventur</span></a></li>');
	}
	
	echo('</ul>
		 </div>
		 </div>
		');
	
    echo(' <div style="width:927px; overflow:auto; margin:0px auto;  background-color:#FFFFFF">
			 <div style="float:right; margin:10px; background-color:#FFFFFF">'.$_SESSION['Admin'].': <input type="button" value="Logout" onclick="location.href=\'./logout.php\'" /></div>	
			  <div style="width:760px; overflow:auto; margin:5% auto;  background-color:#FFFFFF">
					 
					<span id="adminControl"> Willkommen im Administrationsbreich. Bitte aus den Möglichkeiten im orangen Menü wählen.');
					if ( $_SESSION['AUTH_LEVEL'] >= 3) {
							 mysql_connect($host,$username,$password);
							 mysql_select_db($database);
							 
							$saldo  = mysql_query("SELECT SUM(kontostand) FROM saufanten"); 
							list($saldo)  = mysql_fetch_row($saldo);
							
							if($saldo >= 0) {
								  $saldoTxt ='<font color="#00FF00"><font size="+1"> +'.$saldo.'</font size> </font color>&euro;';  
							} else {
								  $saldoTxt ='<font color="#FF0000"><font size="+1"> '.$saldo.'</font size> </font color> &euro;';  
							}
													
							echo('<br><p> Der Gesamtsaldo der Preußen liegt bei'. $saldoTxt.'</p>');
							echo('Einzelübersicht:');
							echo('<hr>');
					
							echo('<table style="margin-left:30px; width:30%;"');
							$users = mysql_query("SELECT * FROM saufanten WHERE status = 'FX' OR status = 'AB' OR status = 'iAB' OR status = 'AH' ORDER BY kontostand ASC"); 
							
							while($row = mysql_fetch_array($users)) {
							  echo('<tr> <td>'.$row['name'].'</td><td>'.($row['kontostand'] < 0 ? '<font color="#FF0000">':'<font color="#00FF00">+').$row['kontostand'].'</font><td><tr>');
							  
							}
							echo('</table>');
				   } // end security check  
				   echo('</span> </div></div>  <!--end container-->');
	    
?>





